package com.chz.SupermarketMS.service;

import com.chz.SupermarketMS.dao.SaleRepository;
import com.chz.SupermarketMS.entities.Sale;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SaleService {
    @Autowired
    SaleRepository saleRepository;

    public Sale save(Sale sale){
        return saleRepository.save(sale);
    }

    public List<Sale> getAll(){
        return saleRepository.findAll();
    }

    public Sale findBySaleId(long theId) {
        return saleRepository.findBySaleId(theId);
    }

    public void delete(Sale theSale) {
        saleRepository.delete(theSale);
    }
}
